#/usr/bin/env perl
use 5.10.0;
use strict;

#获取宽度
print "What column width would you like? ";
chomp(my $width = <STDIN>);

#用户分行键入字符串
print "Enter some lines, then press Ctrl-D:\n";
chomp(my @lines = <STDIN>);

#打印标尺
print "1234567890" x (($width+9)/10), "\n";

#以20个字符宽、向右对齐的方式输出
foreach (@lines) {
    printf "%20s\n", $_;
}

